import Vue from 'vue'

import Cookies from 'js-cookie'

import Element from 'element-ui'
import './assets/styles/index.scss'
import './assets/styles/silver.scss'
import './assets/styles/element-variables.scss'
import App from './App'
import store from './store'
import router from './router'
import directive from './directive' // directive
import plugins from './plugins' // plugins
import {download} from './utils/request'

import './utils/dialog.js'
import './assets/icons' // icon
import './permission' // permission control
import {getDictData, getParam, getQRCode, getStaticData} from "./api/common";
import {addDateRange, handleTree, resetForm} from "./utils/ruoyi";
import {Comment, Table, Timeline, TreeSelect} from 'ant-design-vue'
import moment from 'moment'
// 头部标签组件
import VueMeta from 'vue-meta'
// 分页组件
import Pagination from "./components/Pagination";
// 自定义表格工具组件
import RightToolbar from "./components/RightToolbar"
// 富文本组件
import Editor from "./components/Editor"
// 文件上传组件
import FileUpload from "./components/FileUpload"
// 图片上传组件
import ImageUpload from "./components/ImageUpload"
// 图片预览组件
import ImagePreview from "./components/ImagePreview"
// 字典标签组件
import DictTag from './components/DictTag'
// 字典数据组件
import BoxCard from "./components/Card/BoxCard.vue";
import InfoCard from "./components/Card/InfoCard.vue";
import ContentCard from "./components/Card/ContentCard.vue";
import DetailCard from "./components/Card/DetailCard.vue";
import ListCard from "./components/Card/ListCard.vue";
import ImportCard from "./components/Card/ImportCard.vue";
import RecycleCard from "./components/Card/RecycleCard.vue";
import DictData from './utils/dict/DictData'

moment.defineLocale('zh-cn', {
  relativeTime: {
    future: '%s内',
    past: '%s前',
    s: '几秒',
    m: '1 分钟',
    mm: '%d 分钟',
    h: '1 小时',
    hh: '%d 小时',
    d: '1 天',
    dd: '%d 天',
    M: '1 个月',
    MM: '%d 个月',
    y: '1 年',
    yy: '%d 年'
  }
})
Vue.prototype.$moment = moment
// 全局方法挂载
Vue.prototype.getParam = getParam
Vue.prototype.getDictData = getDictData
Vue.prototype.getStaticData = getStaticData
Vue.prototype.getQRCode = getQRCode
Vue.prototype.resetForm = resetForm
Vue.prototype.addDateRange = addDateRange
Vue.prototype.download = download
Vue.prototype.handleTree = handleTree
Vue.config.productionTip = false

Vue.use(directive)
Vue.use(plugins)
Vue.use(VueMeta)
Vue.use(Table)
Vue.use(Comment)
Vue.use(TreeSelect)
Vue.use(Timeline)
// 全局组件挂载
Vue.component('InfoCard', InfoCard)
Vue.component('BoxCard', BoxCard)
Vue.component('ContentCard', ContentCard)
Vue.component('DetailCard', DetailCard)
Vue.component('DictTag', DictTag)
Vue.component('Editor', Editor)
Vue.component('ListCard', ListCard)
Vue.component('ImportCard', ImportCard)
Vue.component('RecycleCard', RecycleCard)
Vue.component('Pagination', Pagination)
Vue.component('RightToolbar', RightToolbar)
Vue.component('FileUpload', FileUpload)
Vue.component('ImageUpload', ImageUpload)
Vue.component('ImagePreview', ImagePreview)
DictData.install()

/**
 * If you don't want to use mock-server
 * you want to use MockJs for mock api
 * you can execute: mockXHR()
 *
 * Currently MockJs will be used in the production environment,
 * please remove it before going online! ! !
 */

Vue.config.productionTip = false
// 修改 el-dialog 默认点击遮照为不关闭
Element.Dialog.props.closeOnClickModal.default = false

Vue.use(Element, {
  size: Cookies.get('size') || 'medium' // set element-ui default size
})

// Vue.use(ElementTiptapPlugin, {
//   lang: 'zh'
//   /* 插件配置项 */
// })

Vue.config.productionTip = false

new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App)
})
